home *** CD-ROM | disk | FTP | other *** search
/ Complete Linux / Complete Linux.iso / docs / system / mail / transpor / ifmail23.z / ifmail23 / ifmail / ifcico / callall.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-05-03  |  1.5 KB  |  79 lines

  1. #include <stdlib.h>
  2. #include <stdio.h>
  3. #include <string.h>
  4. #include "xutil.h"
  5. #include "lutil.h"
  6. #include "ftn.h"
  7. #include "nodelist.h"
  8. #include "config.h"
  9. #include "scanout.h"
  10.  
  11. static int each(faddr*,char,int,char*);
  12.  
  13. static fa_list *alist=NULL;
  14.  
  15. fa_list *callall(void)
  16. {
  17.     fa_list *tmp;
  18.     int rc;
  19.  
  20.     debug(7,"callall requested");
  21.  
  22.     if (alist) 
  23.     {
  24.         for (tmp=alist;tmp;tmp=alist)
  25.         {
  26.             alist=tmp->next;
  27.             tidy_faddr(tmp->addr);
  28.             free(tmp);
  29.         }
  30.         alist=NULL;
  31.     }
  32.  
  33.     if ((rc=scanout(each)))
  34.     {
  35.         logerr("Error scanning outbound, aborting");
  36.         return NULL;
  37.     }
  38.  
  39.     return alist;
  40. }
  41.  
  42. static int each(addr,flavor,isflo,fname)
  43. faddr *addr;
  44. char flavor;
  45. int isflo;
  46. char *fname;
  47. {
  48.     fa_list **tmp;
  49.  
  50.     if ((flavor == 'h') || (flavor == 'r') ||
  51.         ((isflo != OUT_PKT) && (isflo != OUT_FLO)))
  52.         return 0;
  53.  
  54.     for (tmp=&alist;*tmp;tmp=&((*tmp)->next))
  55.         if (((*tmp)->addr->zone == addr->zone) &&
  56.             ((*tmp)->addr->net == addr->net) &&
  57.             ((*tmp)->addr->node == addr->node) &&
  58.             ((*tmp)->addr->point == addr->point) &&
  59.             (((*tmp)->addr->domain == NULL) ||
  60.              (addr->domain == NULL) ||
  61.              (strcasecmp((*tmp)->addr->domain,addr->domain) == 0)))
  62.             break;
  63.     if (*tmp == NULL)
  64.     {
  65.         *tmp=(fa_list *)xmalloc(sizeof(fa_list));
  66.         (*tmp)->next=NULL;
  67.         (*tmp)->addr=(faddr *)xmalloc(sizeof(faddr));
  68.         (*tmp)->addr->name=NULL;
  69.         (*tmp)->addr->zone=addr->zone;
  70.         (*tmp)->addr->net=addr->net;
  71.         (*tmp)->addr->node=addr->node;
  72.         (*tmp)->addr->point=addr->point;
  73.         (*tmp)->addr->domain=xstrcpy(addr->domain);
  74.  
  75.         debug(7,"has mail to %s",ascfnode((*tmp)->addr,0x1f));
  76.     }
  77.     return 0;
  78. }
  79.